/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package cong.javadanang.controller.bean;

import cong.javadanang.model.dao.CategoryDAO;
import cong.javadanang.model.dao.impl.CategoryDAOImpl;
import cong.javadanang.model.entity.Category;
import java.util.List;
import javax.faces.bean.ManagedBean;
import javax.faces.bean.RequestScoped;

/**
 *
 * @author Pham
 */
@ManagedBean
@RequestScoped
public class CategoryBean {

    private final CategoryDAO CATE_SERVICE = CategoryDAOImpl.getInstance();
    
    private Category category;
    private List<Category> categorys;
    

    public Category getCategory() {
        if(category == null)
            category = new Category();
        return category;
    }

    public void setCategory(Category category) {
        this.category = category;
    }

    public List<Category> getCategorys() {
        categorys = CATE_SERVICE.getAllCategorys();
        return categorys;
    }

    public void setCategorys(List<Category> categorys) {
        this.categorys = categorys;
    }
    
}
